package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM user WHERE openid = #{openid}")
    User selectByOpenid(String openid);

   @Insert("INSERT INTO user (openid, create_time) VALUES (#{openid}, #{createTime})")
   //返回主键id
   @Options(useGeneratedKeys = true, keyProperty = "id") //主键id
    void insert(User user);


}
